package cn.schoolwow.util.module.query.queryPackage.flow;

import cn.schoolwow.quickflow.domain.FlowContext;
import cn.schoolwow.quickflow.flow.BusinessFlow;

import java.util.ArrayList;
import java.util.List;

public class GetClassNameListFlow implements BusinessFlow {
    @Override
    public void executeBusinessFlow(FlowContext flowContext) throws Exception {
        List<Class> classList = flowContext.getData("classList", List.class);

        if(null==classList||classList.isEmpty()){
            flowContext.brokenCurrentFlow("类列表为空");
        }
        List classNameList = new ArrayList();
        for(Class clazz:classList){
            classNameList.add(clazz.getName());
        }
        flowContext.putTemporaryData("classNameList", classNameList);
    }

    @Override
    public String name() {
        return "获取类名列表";
    }
}
